<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <form method="POST" id="list" action="{:U('proExport')}">
        <input type="hidden" name="batch" value="{$batch}">
        <div class="main-title">
            <h2> {$title}</h2>
            <button type="submit" class=" confirm btn btn-default">导出</button>
        </div>

    </form>

    <div class="cf">
        <div class="fl">
            <a href="{:U('addspecprice')}&batch={$batch}" class="btn btn-primary" >快速规格定价</a>
        </div>
        <div class="search-form fr cf">
            <div class="sleft" >
                <input type="text"  name="BIN" class=" search-input form-control " value="{:I('BIN')}" placeholder="商品编码" style="height:28px;width: 120px;" />
            </div>
            <div class="sleft" >
                <input type="text"  name="pname" class=" search-input form-control " value="{:I('pname')}" placeholder="商品名称" style="height:28px;width: 120px;" />
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('')}&batch={:I('batch')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <div>
        <div class="data-table table-striped">
            <table>
                <thead>
                <tr>
                    <th>已定价</th>
                    <th>商品编码</th>
                    <th>商品名称</th>
                    <th>规格</th>
                    <th>基础成本</th>
                    <th>检测规格数</th>
                    <th>世果成本</th>
                    <th>定价人</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                    <volist name="_list" id="vo">
                        <tr>
                            <td>
                                <if condition="$vo['specpricenum'] gt 0">
                                    <a class="btn btn-primary" href="{:U('sellpricedetail')}&batch={$vo.batch}&pname={$vo.erp_pname}">
                                        {$vo.specpricenum}
                                    </a>
                                    <else/>
                                    <a class="btn btn-warning">
                                        {$vo.specpricenum}
                                    </a>
                                </if>
                            </td>
                            <td>
                                <span> {$vo.BIN}</span>
                            </td>
                            <td>
                                <span>{$vo.erp_pname}</span>
                            </td>
                            <td>
                                <span>{$vo.erp_spec}</span>
                            </td>
                            <td>
                                <span>{$vo.base_price}</span>
                            </td>
                            <td>
                                <if condition="$vo['zjnum'] gt 0">
                                    <a class="btn btn-info" role="button" data-toggle="collapse" href="#{$vo.BIN}" aria-expanded="false" aria-controls="{$vo.BIN}">
                                        {$vo.zjnum}
                                    </a>
                                    <else/>
                                    <a class="btn btn-warning">
                                        {$vo.zjnum}
                                    </a>
                                </if>
                            </td>
                            <td>
                                <span>{$vo.sg_base_price}</span>
                            </td>
                            <td>
                                <span>{$vo.uid|get_nickname}</span>
                            </td>
                            <td>
                                <a href="{:U('Dingjia/basePriceDel')}&id={$vo.id}" class="ajax-get confirm btn btn-danger">删除</a>
                                <a href="{:U('Dingjia/addspecprice')}&id={$vo.id}" class="  btn btn-primary">规格定价</a>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="8">
                                <div class="collapse" id="{$vo.BIN}">
                                    <div class="well" style="margin: 0;padding: 0;">
                                        <table class="table" style="margin-bottom: 0;">
                                            <volist name="vo.zjlist" id="vl">
                                                <tr>
                                                    <td>├</td>
                                                    <td>{$vl.BIN}</td>
                                                    <td>{$vl.pname}</td>
                                                    <td>{$vl.spec}</td>
                                                </tr>
                                            </volist>
                                        </table>
                                    </div>
                                </div>
                            </td>
                        </tr>

                    </volist>
                </tbody>
            </table>
        </div>
    </div>

    <div class="page">
        {$_page}
    </div>
    <div class="col-md-12">
        <a  class="btn btn-success" id="fh" onclick="javascript:history.back(-1); return false;">返 回</a>
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
        $("#search").click(function(){
            var url = $(this).attr('url');
            var query  = $('.search-form').find('.search-input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav('{:U('Dingjia/batchlist')}');
        $(".time").datetimepicker({
            format: 'Y-m-d'
        });
    </script>
</block>
